/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/**
 * <p>Project: jse2302 - Demo
 * <p>Powered by webrx On 2023-06-28 16:09:08
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] args) {


        Show s = str -> {
            Random rand = new Random();
            int c = rand.nextInt(31, 37);
            System.out.printf("\33[%dm%s\33[0m%n", c, str);
        };
        s.show("hello");
        s.show("hello");
        s.show("hello");
        s.show("hello");
        s.show("hello");

        List<String> list = List.of("aaa", "bbb", "ccc", "javascript");
        List<String> list1 = List.of("aaa", "bbb", "ccc", "javascript");

        list.forEach(s::show);
        list1.forEach(Demo::print);



        list.forEach(Demo::print);



        //list.forEach(s::show);
        //
        //
        //MyMath mm = i -> i*i;




        //MyMath m2 = i -> i*i*i;
        //
        //System.out.println(mm.nf(6));
        //System.out.println(m2.nf(2));

        List<Integer> ln = new ArrayList<>(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9,11,12));
        System.out.println(ln);


        ln.stream().map(i -> i*i).forEach(e->{
            String str = String.valueOf(e);
            s.show(str);
        });

        //for (int i = 0; i < ln.size(); i++) {
        //    if(ln.get(i) % 2 ==0){
        //       ln.set(i,ln.get(i)*ln.get(i));
        //    }
        //}
        //System.out.println(ln);


    }
    public static void  print(String str){
        System.out.println(str);
    }
}
